package org.example.service.impl;

import org.example.service.IFooService;
import org.example.service.IQuxService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.concurrent.TimeUnit;

/**
 * Created on 2020/3/23
 */
@Service("fooService")
public class FooServiceImpl implements IFooService {

    @Autowired(required = false)
    private IQuxService quxService;

    @Override
    public String hello() {
        return quxService.hello();
    }

    @Override
    public String notwork() {
        return "Hello!";
    }

    @Override
    public String exhaust() {
        // 模拟耗时操作
        try {
            TimeUnit.MILLISECONDS.sleep(new Random().nextInt(1000));
        } catch (InterruptedException e) {
        }
        return "Hello!";
    }
}
